﻿using System;
using System.Linq;

namespace Se.Framework.Common.Extentions
{
    public static class EventHandlerExtentions
    {
        public static void RaiseEvent(this EventHandler @event, object sender, EventArgs e)
        {
            if (@event != null)
            {
                @event(sender, e);
            }
        }
   
        public static void RaiseEvent(this EventHandler @event, object sender)
        {
            RaiseEvent(@event, sender, EventArgs.Empty);
        }

        public static void RaiseEvent<T>(this EventHandler<T> @event, object sender, T e)
            where T : EventArgs
        {
            if (@event != null)
            {
                @event(sender, e);
            }
        }
    }
}